


import 'package:flutter/foundation.dart';
import 'package:mmkv/mmkv.dart';

import '../utils/app_utils.dart';
import '../utils/log_utils.dart';


class AppInfo extends ChangeNotifier {

  AppInfo._internal();

  static final AppInfo _singleton = AppInfo._internal();

  factory AppInfo() => _singleton;

  /// 站点名
  String _stationName = "";
  String get stationName => _stationName;

  /// 当前时间
  String _currentTime = AppUtils.getTime();
  String get currentTime => _currentTime;

  /// 当前时间
  String _machineId = "1001";
  String get machineId => _machineId;

  void setStationName(String stationName){
    _stationName = stationName;
    notifyListeners();
  }

  void setCurrentTime(String currentTime){
    _currentTime = currentTime;
    notifyListeners();
  }

  void setMachineId(String machineId){
    _machineId = machineId;
    notifyListeners();
  }


  loadFromLocal() {
    try {
      MMKV mmkv = MMKV.defaultMMKV();
    } catch(e) {
      LogUtils.e("load user info from local error- $e");
    }
  }
}